package org.example.ttms.customize;

import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

import java.io.IOException;
import java.util.Objects;

public class Window {

    protected String title;
    public static Stage stage;

    public void window(String url){
        stage = new Stage();
        stage.setTitle(title);
        stage.getIcons().add(new Image("C:\\project\\trainTicketManagementSystem\\TTMS\\src\\main\\resources\\org\\example\\ttms\\image\\1.png"));
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(url));
        try {
            Scene scene = new Scene(fxmlLoader.load());
            scene.getStylesheets().add(Objects.requireNonNull(Objects.requireNonNull(getClass().getResource("/org/example/ttms/css/style.css")).toExternalForm()));
            stage.setScene(scene);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        stage.show();
    }

}
